home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / mobile / fma-2.0-stable-setup.exe / {app} / source / uInetGet.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-12-17  |  2.5 KB  |  89 lines

  1. unit uInetGet;
  2.  
  3. {
  4. *******************************************************************************
  5. * Descriptions: Downloads file(s) from Internet using Windows Inet APIs.
  6. * $Source: /cvsroot/fma/fma/uInetGet.pas,v $
  7. * $Locker:  $
  8. *
  9. * Todo:
  10. *
  11. * Change Log:
  12. * $Log: uInetGet.pas,v $
  13. * Revision 1.2  2003/12/17 11:37:19  z_stoichev
  14. * Simple mode changes.
  15. *
  16. * Revision 1.1  2003/12/11 14:17:25  z_stoichev
  17. * Initil checkin.
  18. *
  19. *
  20. *
  21. }
  22.  
  23. interface
  24.  
  25. function IsInetDownloadAvailable: boolean;
  26.  
  27. var
  28.   InetDownload: function (hWnd: Integer; URL, Filename: PChar): Integer; stdcall;
  29.   InetAddFile: procedure (URL, Filename: PChar); stdcall;
  30.   InetAddFileSize: procedure (URL, Filename: PChar; Size: Cardinal); stdcall;
  31.   InetDownloadFiles: function (hWnd: Integer): Integer; stdcall;
  32.   InetClearFiles: procedure; stdcall;
  33.   InetIsConnected: function: Integer; stdcall;
  34.   InetSetOption: function (Option, Value: PChar): Integer; stdcall;
  35.   InetGetFileName: function (URL: PChar): PChar; stdcall;
  36.  
  37. procedure InitInetDownload(ATitle,ALabel,ADescription: string; SimpleMode: boolean = False; ResumeDownloads: boolean = True);
  38.  
  39. implementation
  40.  
  41. uses
  42.   Windows;
  43.  
  44. var
  45.   isxdl: THandle;
  46.  
  47. function IsInetDownloadAvailable: boolean;
  48. begin
  49.   Result := isxdl <> 0;
  50. end;
  51.  
  52. procedure InitInetDownload(ATitle,ALabel,ADescription: string; SimpleMode,ResumeDownloads: boolean);
  53. begin
  54.   if IsInetDownloadAvailable then begin
  55.     InetClearFiles;
  56.     InetSetOption('title',PChar(ATitle));
  57.     InetSetOption('label',PChar(ALabel));
  58.     InetSetOption('description',PChar(ADescription));
  59.     if ResumeDownloads then
  60.       InetSetOption('resume','true')
  61.     else
  62.       InetSetOption('resume','false');
  63.     if SimpleMode then
  64.       InetSetOption('simple',PChar(ADescription))
  65.     else
  66.       InetSetOption('simple','');
  67.   end;
  68. end;
  69.  
  70. initialization
  71.   isxdl := LoadLibrary('isxdl.dll');
  72.   if isxdl <> 0 then begin
  73.     InetDownload := GetProcAddress(isxdl,'isxdl_Download');
  74.     InetAddFile := GetProcAddress(isxdl,'isxdl_AddFile');
  75.     InetAddFileSize := GetProcAddress(isxdl,'isxdl_AddFileSize');
  76.     InetDownloadFiles := GetProcAddress(isxdl,'isxdl_DownloadFiles');
  77.     InetClearFiles := GetProcAddress(isxdl,'isxdl_ClearFiles');
  78.     InetIsConnected := GetProcAddress(isxdl,'isxdl_IsConnected');
  79.     InetSetOption := GetProcAddress(isxdl,'isxdl_SetOption');
  80.     InetGetFileName := GetProcAddress(isxdl,'isxdl_GetFileName');
  81.   end;
  82. finalization
  83.   if isxdl <> 0 then begin
  84.     FreeLibrary(isxdl);
  85.     isxdl := 0;
  86.   end;
  87. end.
  88.  
  89.